package com.zzh.myapplication.app;

import android.app.Application;
import android.content.Context;
import android.support.v7.app.AppCompatActivity;

import com.amap.api.location.AMapLocation;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.google.gson.Gson;

import net.icarplus.car.bean.AcctResultInfo;
import net.icarplus.car.constant.Content;
import net.icarplus.car.manager.AppManager;
import net.icarplus.car.tools.FileUtil;

/**
 * 项目名称：icarplus-car-android
 * 类描述：
 * 创建人：Gophy
 * 创建时间：16/3/7 15:41
 * 修改人：Gophy
 * 修改时间：16/3/7 15:41
 * 修改备注：
 */
public class MyApplication extends Application {
    // 电子账户信息
    public static AcctResultInfo acctResultInfo;

    public static Gson gson;

    public static AMapLocation aAMapLocation = null;

    @Override
    public void onCreate() {
        super.onCreate();

        Fresco.initialize(this);
        gson = new Gson();
        // 创建目录
        FileUtil.createOrReplaceDir(Content.SDCARDHOME);
        FileUtil.createOrReplaceDir(Content.SDCARDCACHE);
        FileUtil.createOrReplaceDir(Content.SDCARDIMAGE);
        FileUtil.createOrReplaceDir(Content.SDCARDFILE);
        FileUtil.createOrReplaceDir(Content.SDCARDIMAGEUPLOADCACHE);
    }


    public static Context getContext() {
        AppManager am = AppManager.getAppManager();
        if (am != null) {
            AppCompatActivity ba = am.currentActivity();
            return ba;
        } else {
            return null;
        }
    }
}
